package com.cuixk.microservice.eureka.controller;

import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class ServiceInstanceRestController {

    @Resource
    private DiscoveryClient discoveryClient;

    @GetMapping("/get")
    public List<ServiceInstance> getByAppName(String name){
        return discoveryClient.getInstances(name);
    }
}
